package com.cdel.akka.AkkainJAVA.prioMailbox;

import com.typesafe.config.ConfigFactory;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.PoisonPill;
import akka.actor.Props;

//自定义优先级邮箱
public class PrioMailboxTest {
      public static void main(String[] args) throws InterruptedException {
          ActorSystem system = ActorSystem.create( "MySystem", ConfigFactory.load("prio").getConfig("PrioApp"));
          ActorRef myActor = system.actorOf(Props.create(SimpleActor.class ).withDispatcher("priorityMailBox-dispatcher" ));
          myActor.tell( "lowpriority" , null );
          myActor.tell( "lowpriority" , null );
          myActor.tell( "highpriority" , null );
          myActor.tell( "pigdog" , null );
          myActor.tell( "pigdog2" , null );
          myActor.tell( "pigdog3" , null );
          myActor.tell( "highpriority" , null );
          myActor.tell(PoisonPill. getInstance(), null);

          Thread. sleep(2000);
          //system.shutdown();
     }

}
